﻿/**
 * @author macj
 */

$(document).ready(function(){
	var p = 2;
	var i = 1;
	$(document).scrollTop(0)
 	$(function(){
		//获取数据
		function showload()
		{ 
	 		$.get(url+"/ajax/p/"+p, function(data){
	 			if(data){
		 			$(".special_content").append(data);
		 			
		 			++p;
		 			++i;
	 			}
		 		
		 	});
		}
		
		//绑定事件
		$(window).bind("scroll", function(){
			if($(document).scrollTop() + $(window).height() > $(document).height() - 10 && i==1) {
				 i=0;
				 showload();
			}
		}); 
	})


 	
});

function  ScollPostion() {//滚动条位置
    var t, l, w, h;
    if (document.documentElement && document.documentElement.scrollTop) {
        t = document.documentElement.scrollTop;
        l = document.documentElement.scrollLeft;
        w = document.documentElement.scrollWidth;
        h = document.documentElement.scrollHeight;
    } else if (document.body) {
        t = document.body.scrollTop;
        l = document.body.scrollLeft;
        w = document.body.scrollWidth;
        h = document.body.scrollHeight;
    }
    return { top: t, left: l, width: w, height: h };

    

}